package com.kk.score.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kk.score.entity.GradeEntity;
import com.kk.score.entity.PushEntity;
import com.kk.score.entity.PushGradeEntity;
import com.kk.score.entity.TaskEntity;
import com.kk.score.entity.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author KK
 * @email 409592048@qq.com
 * @date 2022-11-02 12:28:00
 */
@Mapper
public interface GradeDao extends BaseMapper<GradeEntity> {

    /**
     * 批量开启任务
     *
     * @return
     */
    int insertAll(PushGradeEntity pushGrade);

    /**
     * 开启一个用户的任务
     *
     * @return
     */
    int insertByUser(PushGradeEntity pushGrade,String userUid);

    /**
     * 批量更新任务
     *
     * @return
     */
    int updateTask(GradeEntity grade);

    /**
     * 用户查询任务
     *
     * @param page
     * @param status
     * @return
     */
    IPage<GradeVo> findGradeAllByUser(Page<GradeVo> page, String userUid, String status);

    /**
     * 用户查询任务
     *
     * @return
     */
    List<GradeVo> findGradeAllByUser(String userUid);

    /**
     * 根据pushUid获取任务的人评价详情
     *
     * @param page
     * @param pushUid
     * @return
     */
    IPage<GradePersonVo> findGradePersonByPushUid(Page<GradePersonVo> page,@Param("pushUid") String pushUid);

    /**
     * 根据pushUid获取任务的人评价详情
     *
     * @return
     */
    List<GradePersonVo> findGradeByPushUid(String pushUid);

    /**
     * 查询满意度任务
     *
     * @param page
     * @param status
     * @param year
     * @return
     */
    IPage<?> findPushPage(Page<UnitVo> page, String status, String year);
}
